package com.cal.utms.action.payment;

import com.cal.utms.dto.payment.PledgeDto;
import com.cal.utms.model.payment.PledgeModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class PledgeAction extends ActionSupport implements ModelDriven<PledgeDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private PledgeDto pledgeDto = new PledgeDto();
	PledgeModel model = new PledgeModel();

	private int fundId;
	private String pledges;
	private int customerId;
	private int pledgeid;

	public String getAllInvestment() {
		pledgeDto.setPledgeDtos(model.getInvestmentForPledge(fundId, customerId));
		return Action.SUCCESS;
	}

	public String releasePledgeunits() {
		model.releaseUnits(pledgeDto, pledgeid);
		return Action.SUCCESS;
	}

	public String savePledge() {
		model.savePledge(pledges, pledgeDto);
		return Action.SUCCESS;
	}

	public String getPledgeBycusAndFund() {
		pledgeDto.setPledgeDtos(model.getPledge(fundId, customerId));
		return Action.SUCCESS;
	}

	@Override
	public PledgeDto getModel() {
		return pledgeDto;
	}

	public PledgeDto getPledgeDto() {
		return pledgeDto;
	}

	public void setPledgeDto(PledgeDto pledgeDto) {
		this.pledgeDto = pledgeDto;
	}

	public int getFundId() {
		return fundId;
	}

	public void setFundId(int fundId) {
		this.fundId = fundId;
	}

	public String getPledges() {
		return pledges;
	}

	public void setPledges(String pledges) {
		this.pledges = pledges;
	}

	public int getCustomerId() {
		return customerId;
	}

	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	public int getPledgeid() {
		return pledgeid;
	}

	public void setPledgeid(int pledgeid) {
		this.pledgeid = pledgeid;
	}

}
